﻿using configure_hot_update.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using static configure_hot_update.Models.WeChatSettings;

namespace configure_hot_update.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class NormalController(
        IOptions<WeChatSettings> wechatOptions, IOptions<PaymentConfig> payOptions) : ControllerBase
    {
        private readonly WeChatSettings wechatSettings = wechatOptions.Value;
        private readonly PaymentConfig payConfig = payOptions.Value;

        [HttpGet]
        public IActionResult GetConfig()
        {
            return Ok(new 
            {
                wechatSettings.AppId,
                wechatSettings.AppSecret,
                wechatSettings.OAuth,
                wechatSettings.Payment
            });
        }

        [HttpGet]
        public IActionResult GetChilderConfig()
        {
            return Ok(new
            {
                payConfig.MchId,
                payConfig.ApiKey,
                payConfig.CertPath
            });
        }
    }
}
